home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of Shareware
/
Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso
/
mac
/
DOS
/
UTILITY
/
MXMNU238
/
TMAX.MNU
< prev
next >
Wrap
Text File
|
1992-03-09
|
12KB
|
513 lines
Comment
================================================
MarxMenu TaskMax Interface.
Copyright 1992 by Marc Perkel * All Rights Reserved
This menu requires DR-DOS 6.0 and TaskMax to run.
This example was designed to work with programs I have. It can be
easilly reconfigured to work with your programs. It may be more
elaborate than what you need.
To start this menu run MARXMENU TMAX.
This menu has many advantages over the default TaskMax menu. One is that
it is much more flexable. Not only can you start a command line but you
can start applications as well.
This menu also gives you the ability to preload tasks so that they are
ready to be switched to. It also gives you the ability to set up timed
execution; running a program and comming back to the menu automatically.
It can also allow you to manage the paste buffer. You can view it or
pre-load it with anything you want. This menu can be modified to allow
you to save paste buffers in a stack for later retrieval.
It also helps you retain your network security. The TaskMax menu only
allows you to start a command line. Under MarxMenu you can restrict
users from the command line and completely control the task switcher
globally. Different users might have different menu options depending on
what Novell groups they're in.
By using the screen blanker and automatic logoff features built into
MarxMenu network security features are enhanced. The user can at any
point switch to this menu and activate the screen blanker. The options
in TMAX.INC can be set to require a password to unblank the screen.
================================================
EndComment
Var
Tasks
NameList
ChoiceCount
UnLoad
MyTask
NukeMe
StatWin
FilePicked
LastTask
PickChoices
Qualifier
TaskName
TaskID
;----- Get out if not running TaskMax
if not TMaxInstalled
StandardIO
Writeln
Writeln 'Requires DR-DOS TaskMax to Run!'
ExitMenu
endif
StatusLineText = '*-<< Acme Manufacturing Company >>-*'
MenuTitle = "Joe Blow's Pop Up Menu"
Include 'TMAX.INC'
Setup
Main
ExitMenu
;================================================
Procedure Select
var Ch H P X Y W Indent MaxSingleColumn
MaxSingleColumn = 5
OnScreenOnly
BuildChoices
Status
Explode Off
H = ChoiceCount
Indent = ''
W = 29
if ChoiceCount > MaxSingleColumn
H = ChoiceCount + 1 / 2
Indent = ' '
W = 32
endif
H = H + 8 + HeightDifference
if ChoiceCount = 0 then H = H - 1
DrawTheBox (5,(ScreenHeight - H) / 2 + 2,W,H,'MarxMenu TaskMax Menu')
Explode On
CapsColor(MenuCapColorFG,MenuBG)
Loop Choices
if ChoiceCount > MaxSingleColumn
X = 1
if LoopIndex mod 2 = 0 then X = 14
Y = LoopIndex - 1 / 2 + 1
GotoXY X Y
endif
Writeln Choices[LoopIndex]
EndLoop
if ChoiceCount > 0
TextColor MenuVertLinesFG MenuBG
ClearLine '─'
Writeln
TextColor MenuInsideFG MenuBG
CapsColor(MenuCapColorFG,MenuBG)
endif
if LastTask > TMaxMaxTasks then LastTask = 0
if ChoiceCount = 1 then LastTask = 1
if ChoiceCount = 0 then Suggest '1'
if LastTask > 0
Suggest Char(LastTask + 64)
endif
Writeln Indent ' 1 - New Command Line'
Writeln Indent ' 2 - Directory Master'
Writeln Indent ' 3 - Type in a Command'
Writeln Indent ' 4 - TaskMax Control'
Writeln Indent ' 5 - Delete a Task'
Writeln Indent ' 6 - Applications'
Write Indent ' U - Unload This Menu'
Ch = ReadKey
if (Ch >= 'A') and (Ch <= Char(ChoiceCount + 64))
SwitchTasks(Tasks[(ord(Ch) - 64)].TaskID)
elseif Ch = '1'
if ExistOnPath('DOLIST.EXE') > ''
CreateTask('DOLIST.EXE')
else
CreateTask('COMMAND')
endif
elseif Ch = '2'
P = PosInList('DM3',NameList)
;----- If DM3 is running the select it else start a new one
if P = 0
CreateTask('DM3.EXE')
else
SwitchTasks(Tasks[P].TaskID)
endif
elseif Ch = '3'
TypeACommand
elseif Ch = '4'
SetOptions
elseif Ch = '5'
KillTasks
elseif Ch = '6'
Applications
EraseTopWindow
elseif Ch = 'U'
Unload = True
elseif Ch = ESC
if ChoiceCount = 0
Unload = True
else
if LastTask > 0
SwitchTasks(Tasks[LastTask].TaskID)
endif
endif
endif
EraseTopWindow
EndProc
Procedure Main
TMaxTakeOver On
while not Unload
Select
EndWhile
TMaxTakeOver Off
EndProc
Procedure TypeACommand
var St
DrawBox 10 21 60 3
TextColor MenuHeaderFG MenuBG
Write ' Type Command: '
TextColor MenuInsideFG MenuBG
St = Readln
EraseTopWindow
if St > ''
CreateTask(St)
endif
EndProc
Procedure DrawPickTasksBox (Msg)
var T
PickChoices = Choices
T = ScreenHeight - ChoiceCount / 2
DrawTheBox (29,T,19,ChoiceCount + HeightDifference,Msg)
Loop PickChoices
Trim(PickChoices[LoopIndex])
EndLoop
EndProc
Procedure KillTasks
var Ch ID KillList T FileString Name
DrawPickTasksBox('Kill Tasks')
PickMany(PickChoices,KillList)
EraseTopWindow
Loop PickManyPositions
Name = Tasks[PickManyPositions[LoopIndex]].TaskName
ID = Tasks[PickManyPositions[LoopIndex]].TaskID
T = TMaxTaskOpenFiles(ID)
DrawBox 27 10 19 + length(Name) 3
TextColor MenuHeaderFG MenuBG
Write ' Deleting Task: '
TextColor MenuInsideFG MenuBG
Write Name
if T > 0
FileString = 'Files'
if T = 1 then FileString = 'File'
FileString = Str(T) + ' open ' + FileString
if AskYesNo ('Task has ' + FileString +'. Delete Anyway?')
TMaxDeleteTask(ID)
endif
else
Wait 250
TMaxDeleteTask(ID)
endif
EraseTopWindow
EndLoop
LastTask = 0
EndProc
Procedure CreateTask (Cmd)
TMaxCreateTask(Cmd)
LastTask = TMaxTaskIndex(TMaxResult);
EndProc
Procedure SwitchTasks (T)
TMaxSwitchTasks(T)
;TMaxSwitchTasks returns the TaskID of the last active task in TMaxResult
LastTask = TMaxTaskIndex(TMaxResult);
EndProc
Procedure SwitchTaskByName (Name)
SwitchTasks(Tasks[PosInlist(Name,NameList)].TaskID)
EndProc
Procedure Setup
BuildChoices
;----- AutoLoad Tasks
;----- Only load DM3.EXE if not already loaded
if (PosInList('DM3',NameList) = 0) and (ExistOnPath('DM3.EXE') > '')
TMaxReturnCount = 40
CreateTask('DM3.EXE')
endif
;----- Only load SideKick 2 if not already loaded
if (PosInList('SK2',NameList) = 0) and ExistFile('H:\SK2\SKCONFIG.SKC')
TMaxReturnCount = 200
CreateTask('SK2.BAT')
endif
TMaxReturnCount = 0
DrawTheBox (42,ScreenHeight / 2 - 2,32,HeightDifference + 4,'TaskMax Status')
StatWin = CurrentWindow
EndProc
;----- Show Status Information
Procedure Status
SetTopWindow StatWin
TextColor MenuInsideFG MenuBG
Writeln ' Maximum Tasks: ' TMaxMaxTasks
Writeln ' Active Tasks: ' ChoiceCount ' '
Writeln ' EMS Memory Limit: ' TMaxEMSMemLim / 1024 'k '
Write ' Free Disk Space: ' FreeDiskSpace Path / 1000000 'm '
if StatWin < CurrentWindow
SetWindowUnder (StatWin,StatWin + 1)
endif
EndProc
;----- This code reads the task list and processes the choices.
Procedure NewChoice (Num,St)
AppendArray(Choices,' ' + Char(Num + 64) + ' - ' + St)
EndProc
Procedure BuildChoices
MyTask = TMaxThisTask
TMaxReadTaskInfo (Tasks)
Dispose(Choices)
Dispose(NameList)
ChoiceCount = 0
Loop Tasks
if Tasks[LoopIndex].TaskID = MyTask
NukeMe = LoopIndex
else
ChoiceCount = ChoiceCount + 1
NewChoice(ChoiceCount,Tasks[LoopIndex].TaskName)
AppendArray(NameList,Tasks[LoopIndex].TaskName)
endif
EndLoop
;don't show the task switcher task in the task list
delete(Tasks,NukeMe,1)
EndProc
Procedure IsLoaded (Name)
Return PosInList(Name,NameList) > 0
EndProc
Procedure SetOptions
var Ch St PB CurrentBuffer
DrawTheBox (23,ScreenHeight / 2 + 1,29,HeightDifference + 6,'TaskMax Options')
Writeln ' A - Direct Switching'
Writeln ' B - EMS Memory Limit'
Writeln ' C - Copy Data'
Writeln ' D - Paste Data'
Writeln ' E - View Paste Buffer'
Write ' F - Paste my Address'
While Ch <> Esc
Ch = ReadKey
if Ch = 'A'
TMaxDirectSwitching = AskYesNo('Allow use of Direct Switch Keys?')
elseif Ch = 'B'
DrawBox 25 22 31 3
TextColor MenuHeaderFG MenuBG
Write ' EMS Memory Limit (k): '
TextColor MenuInsideFG MenuBG
St = Readln
EraseTopWindow
TMaxEMSMemLim = Value(St) * 1024
elseif Ch = 'C'
Cut
elseif Ch = 'D'
Paste
elseif Ch = 'E'
ViewPasteBuffer
elseif Ch = 'F'
Dispose(PB)
AppendArray(PB,'Computer Tyme')
AppendArray(PB,'411 North Sherman Suite 300')
AppendArray(PB,'Springfield MO. 65802')
AppendArray(PB,'417-866-1222')
;save and restore current paste buffer
TMaxGetPasteBuffer(CurrentBuffer)
TMaxSetPasteBuffer(PB)
Paste
TMaxSetPasteBuffer(CurrentBuffer)
endif
endwhile
EraseTopWindow
EndProc
Procedure Cut
var C
DrawPickTasksBox('Cut from Task')
C = PickOne(PickChoices)
EraseTopWindow
if PickPosition <> 0
TMaxCut(Tasks[PickPosition].TaskID)
endif
EndProc
Procedure Paste
var C
DrawPickTasksBox('Paste to Task')
C = PickOne(PickChoices)
EraseTopWindow
if PickPosition <> 0
TMaxPaste(Tasks[PickPosition].TaskID)
endif
EndProc
Procedure ViewPasteBuffer
var Paste
BoxHeader = ' Viewing Paste Buffer '
Shadow Off
DrawBox 1 4 ScreenWidth ScreenHeight - 4
TextColor MenuHeaderFG MenuBG
TMaxGetPasteBuffer(Paste)
ViewArray(Paste)
EndProc
;----- Applications Menu
Procedure Applications
Dispose Choices
AddChoice('Pick Directory',1)
AddChoice('TapCIS',2)
AddChoice('Telemate',3)
CenterStretchBox ('DOS Menu',38,15)
LastKey = UpperCase(ReadKey)
while True
if LastKey = Task(1)
CreateTask('PD.EXE')
Return
elseif LastKey = Task(2)
; only load TapCis once
if IsLoaded('TAPCIS')
SwitchTaskByName('TAPCIS')
else
CreateTask('CIS')
endif
Return
elseif LastKey = Task(3)
; only load Telemate once
if IsLoaded('TM')
SwitchTaskByName('TM')
else
CreateTask('TM')
endif
Return
elseif LastKey = Esc
Return
endif
EndWhile
EndProc
Procedure AskYesNo (Question)
var YesNo
DrawBox(34 - (Length(Question) / 2),21,Length(Question) + 14,3)
TextColor MenuHeaderFG MenuBG
UseArrows Off
Cursor On
Write ' ' Question ' (Y/N) '
YesNo = UpperCase(ReadKey)
YesNo = YesNo = 'Y'
TextColor MenuInsideFG MenuBG
if YesNo
Write 'Yes'
else
Write 'No'
endif
Wait 50
EraseTopWindow
UseArrows On
Return YesNo
EndProc